package com.timguan.render.api.entity.dataprocessor;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.annotation.JSONField;

import java.io.Serializable;
import java.util.ArrayList;

/**
 * 与CMS中定义的ITEM一致
 * Created by gkq on 15/9/24.
 */
public class CMSItemInfo implements Serializable {
    /**
     * 数据类型（提供给前端识别用来套用子view能识别，主要提供给APP使用）
     */
    public enum DataType {
        ITEM, LINK, IMG, HTML, ANONYMOUS;
    }

    /**
     * 动作类型（前端识别，做数据兼容，主要APP使用）
     */
    public enum ActionType {
        LINK, CARD, BAG, CART;
    }

    private String itemId;
    private String link;
    private String h5link;
    private String imgUrl;
    private String name;
    private String subName;
    private String nation;
    private String showNationalUrl;
    private String shippingPoint;
    private String priceLabel;
    private int salePrice;
    private int originPrice;
    @JSONField(name = "_vid")
    private String _vid;
    @JSONField(name = "_type")
    private String _type = DataType.ITEM.toString();
    @JSONField(name = "_action")
    private String _action = JSON.toJSONString(new ArrayList<ActionType>() {
        {
            add(ActionType.LINK);
            add(ActionType.CART);
        }
    }.toArray());

    public String get_vid() {
        return _vid;
    }

    public void set_vid(String _vid) {
        this._vid = _vid;
    }

    public String getItemId() {
        return itemId;
    }

    public void setItemId(long itemId) {
        this.itemId = String.valueOf(itemId);
    }

    public String getLink() {
        return link;
    }

    public void setLink(String link) {
        this.link = link;
    }

    public String getH5link() {
        return h5link;
    }

    public void setH5link(String h5link) {
        this.h5link = h5link;
    }

    public String getImgUrl() {
        return imgUrl;
    }

    public void setImgUrl(String imgUrl) {
        this.imgUrl = imgUrl;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSubName() {
        return subName;
    }

    public void setSubName(String subName) {
        this.subName = subName;
    }

    public String getNation() {
        return nation;
    }

    public void setNation(String nation) {
        this.nation = nation;
    }

    public String getShowNationalUrl() {
        return showNationalUrl;
    }

    public void setShowNationalUrl(String showNationalUrl) {
        this.showNationalUrl = showNationalUrl;
    }

    public String getShippingPoint() {
        return shippingPoint;
    }

    public void setShippingPoint(String shippingPoint) {
        this.shippingPoint = shippingPoint;
    }

    public String get_type() {
        return _type;
    }

    public String get_action() {
        return _action;
    }

    public String getPriceLabel() {
        return priceLabel;
    }

    public void setPriceLabel(String priceLabel) {
        this.priceLabel = priceLabel;
    }

    public int getSalePrice() {
        return salePrice;
    }

    public void setSalePrice(int salePrice) {
        this.salePrice = salePrice;
    }

    public int getOriginPrice() {
        return originPrice;
    }

    public void setOriginPrice(int originPrice) {
        this.originPrice = originPrice;
    }

    public void setItemId(String itemId) {
        this.itemId = itemId;
    }

    public void set_type(String _type) {
        this._type = _type;
    }

    public void set_action(String _action) {
        this._action = _action;
    }

    @Override
    public String toString() {
        return "CMSItemInfo{" +
                "itemId='" + itemId + '\'' +
                ", link='" + link + '\'' +
                ", h5link='" + h5link + '\'' +
                ", imgUrl='" + imgUrl + '\'' +
                ", name='" + name + '\'' +
                ", subName='" + subName + '\'' +
                ", nation='" + nation + '\'' +
                ", showNationalUrl='" + showNationalUrl + '\'' +
                ", shippingPoint='" + shippingPoint + '\'' +
                ", priceLabel='" + priceLabel + '\'' +
                ", salePrice=" + salePrice +
                ", originPrice=" + originPrice +
                ", _vid='" + _vid + '\'' +
                ", _type='" + _type + '\'' +
                ", _action='" + _action + '\'' +
                '}';
    }
}
